home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / misc / gms_dev.lha / GMSDev / Source / C / Blitter / LineTest.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-09-01  |  2.2 KB  |  88 lines

  1. /* Dice: 1> dcc -l0 -mD dpk.o tags.o LineTest.c -o LineTest
  2. **
  3. ** Line demo.
  4. */
  5.  
  6. #include <proto/dpkernel.h>
  7.  
  8. BYTE *ProgName      = "Line Test";
  9. BYTE *ProgAuthor    = "Paul Manias";
  10. BYTE *ProgDate      = "June 1998";
  11. BYTE *ProgCopyright = "DreamWorld Productions (c) 1996-1998.  Freely distributable.";
  12. BYTE *ProgShort     = "Draws lots of different masked lines.";
  13.  
  14. void main(void)
  15. {
  16.   struct GScreen *Screen;
  17.   struct JoyData *JoyData;
  18.   LONG   palette[] = { PALETTE_ARRAY, 4, 0x000000L, 0xf080f0L, 0x80f0f0, 0xf0f080 };
  19.   WORD   sx,sy,ex,ey;
  20.   LONG   mask;
  21.  
  22.   if (Screen = InitTags(NULL,
  23.       TAGS_SCREEN,    NULL,
  24.         GSA_BitmapTags, NULL,
  25.         BMA_Palette,    palette,
  26.         TAGEND,         NULL,
  27.       TAGEND)) {
  28.  
  29.      if (JoyData = Init(Get(ID_JOYDATA),NULL)) {
  30.  
  31.         Display(Screen);
  32.  
  33.         /*** Pattern 1 ***/
  34.  
  35.         mask = 0x0f0f0f0f;
  36.         sx=0; sy=0; ex=0; ey=Screen->Bitmap->Height-1;
  37.         for (ex=0; ex < Screen->Bitmap->Width; ex++) {
  38.            DrawLine(Screen->Bitmap,sx,sy,ex,ey,1,mask);
  39.         }
  40.         for (ey=Screen->Bitmap->Height-1; ey > 0; ey--) {
  41.            DrawLine(Screen->Bitmap,sx,sy,ex,ey,1,mask);
  42.         }
  43.  
  44.         WaitTime(50);
  45.  
  46.         /*** Clear pattern 1 ***/
  47.  
  48.         mask = 0xffffffff;
  49.         sx=0; sy=0; ex=0; ey=Screen->Bitmap->Height-1;
  50.         for (ex=0; ex < Screen->Bitmap->Width; ex++) {
  51.            DrawLine(Screen->Bitmap,sx,sy,ex,ey,3,mask);
  52.         }
  53.         for (ey=Screen->Bitmap->Height-1; ey > 0; ey--) {
  54.            DrawLine(Screen->Bitmap,sx,sy,ex,ey,3,mask);
  55.         }
  56.  
  57.         WaitTime(10);
  58.  
  59.         /*** Pattern 2 ***/
  60.  
  61.         mask = 0xAAAAAAAA;
  62.         sx=0; sy=0; ex=0; ey=Screen->Bitmap->Height-1;
  63.         for (ex=0; ex < Screen->Bitmap->Width; ex++) {
  64.            DrawLine(Screen->Bitmap,sx,sy,ex,ey,2,mask);
  65.            mask = ~mask;
  66.            sx++;
  67.         }
  68.  
  69.         WaitTime(50);
  70.  
  71.         /*** Clear pattern 2 ***/
  72.  
  73.         mask = 0xffffffff;
  74.         sx=0; sy=Screen->Bitmap->Height-1; ex=Screen->Bitmap->Width-1; ey=Screen->Bitmap->Height-1;
  75.         for (sy=Screen->Bitmap->Height-1; sy >= 0; sy--) {
  76.            DrawLine(Screen->Bitmap,sx,sy,ex,ey,1,mask);
  77.            ey--;
  78.         }
  79.  
  80.         WaitTime(50);
  81.  
  82.      Free(JoyData);
  83.      }
  84.   Free(Screen);
  85.   }
  86. }
  87.  
  88.